﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace msBsc.WebUi.wMall.Seller
{
    public partial class wfAgentDjackOrderList : msBsc.Cls.BPProxyDealer
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public override void DoAction()
        {
            if (this.strAction == "init")
            {
                ShowDjackOrderInfo();
            }
        }

        private void ShowDjackOrderInfo()
        {
            int pageIndex = 1;
            int pageSize = 10;

            if (!int.TryParse(this.GetParamHtValue("pIndex"), out pageIndex))
            {
                pageIndex = 1;
            }

            string orderStatus = this.GetParamHtValue("orderStatus");

            using (msBsc.AppLogic.DataAlc.CBizDiversionOrder objCBizDiversionOrder = new AppLogic.DataAlc.CBizDiversionOrder())
            {
                System.Data.DataSet ds = objCBizDiversionOrder.GetDjackOrderByCondition("", orderStatus, "", "");

                if (ds == null || ds.Tables[0].Rows.Count < 1)
                {

                    this.ExecJScript("$('#orderList').html(\"<p style='width: 200px; margin-left: 30px;' class='car-price'>没有查询到任何相关信息...</p>\");$('#divPage').html('');");
                    return;
                }

                //获取订单各项数量
                this.ExecJScript(@"setAllCount('" + ds.Tables[0].Rows[0]["ALL_ORDER_NUM"].ToString() + "','" + ds.Tables[0].Rows[0]["PAIED_ORDER_NUM"].ToString() + "','" + ds.Tables[0].Rows[0]["FINISHED_ORDER_NUM"].ToString() + "','" + ds.Tables[0].Rows[0]["COMPLETE_ORDER_NUM"].ToString() + "','" + ds.Tables[0].Rows[0]["REFUND_ORDER_NUM"].ToString() + "');");

                //获取数据
                string retJson = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", "", 1, 20, "");
                this.ExecJScript(@"
                            var _html = $('#svc_list_temp_order').html();
                            laytpl(_html).render(" + retJson + @", function (render) {
                                $('#orderList').html(render);
                            });jsPage('divPage', " + ds.Tables[0].Rows[0]["DATACOUNT"] + ", " + pageSize + ", " + pageIndex + ", 'goPage');");
            }
        }
    }
}